﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Katana.DataAccess;

namespace Katana.BusinessLogic
{
    public class TeamController
    {
        #region Public methods

        public static List<Team> GetTeams()
        {
            var teams = from t in KatanaContext.Context.Teams
                        select t;

            return teams.ToList<Team>();
        }

        public static Team GetTeam(Guid teamId)
        {
            Team returnTeam = null;

            var teams = from t in KatanaContext.Context.Teams
                        where t.TeamID == teamId
                        select t;

            foreach (var team in teams)
            {
                returnTeam = team;
            }

            return returnTeam;
        }

        public static List<Lid> GetTeamLeden(Guid teamId)
        {
            Team returnTeam = null;

            var teams = from t in KatanaContext.Context.Teams
                        where t.TeamID == teamId

                        select t;

            foreach (var team in teams)
            {
                returnTeam = team;
            }

            return returnTeam.Leden.ToList<Lid>();
        }

        #endregion
    }
}
